﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using MvcEx.Configuration;
using Moq;

namespace MvcEx.Tests
{
    [TestFixture]
    public class MvcExApplicationThemeSelectorTests
    {
        [Test]
        public void get_active_theme_from_configuration()
        {
            var testConfiguration = new MvcExConfiguration();
            testConfiguration.Id = "something";
            testConfiguration.Theme = "testtheme";
            testConfiguration.Modules = new MvcExConfigurationModule[]{
                new MvcExConfigurationModule()
                { 
                    Name = "Test"
                }
            };

            var applicationMock = new Mock<IMvcExApplication>();
            applicationMock.Setup(x => x.GetActiveConfiguration()).Returns(testConfiguration);

            var selector = new MvcExApplicationThemeSelector(applicationMock.Object);
            String activeTheme = selector.GetActiveTheme();

            Assert.AreEqual("testtheme", activeTheme);            
        }
    }
}
